<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/js/ts/bindings/tests/enums.test-mojom-lite.js"></script>
<script>
'use strict';
test(() => {
  assert_equals(Object.keys(mojo.tstest.EmptyEnum).length, 0);
}, 'Test an empty enum has no properties.');
test(() => {
  assert_equals(mojo.tstest.EnumWithNoValues.ZERO, 0);
  assert_equals(mojo.tstest.EnumWithNoValues.ONE, 1);
  assert_equals(mojo.tstest.EnumWithNoValues.TWO, 2);
  assert_equals(mojo.tstest.EnumWithNoValues.MIN_VALUE, 0);
  assert_equals(mojo.tstest.EnumWithNoValues.MAX_VALUE, 2);
}, 'Test an enum with no values for its fields have correct generated values.');

test(() => {
  assert_equals(mojo.tstest.EnumWithFirstValue.FIVE, 5);
  assert_equals(mojo.tstest.EnumWithFirstValue.SIX, 6);
  assert_equals(mojo.tstest.EnumWithFirstValue.SEVEN, 7);
  assert_equals(mojo.tstest.EnumWithFirstValue.MIN_VALUE, 5);
  assert_equals(mojo.tstest.EnumWithFirstValue.MAX_VALUE, 7);
}, 'Test an enum that starts with a non-zero value has correct generated ' +
   'values.');

test(() => {
  assert_equals(mojo.tstest.EnumWithLastValue.ZERO, 0);
  assert_equals(mojo.tstest.EnumWithLastValue.ONE, 1);
  assert_equals(mojo.tstest.EnumWithLastValue.TEN, 10);
  assert_equals(mojo.tstest.EnumWithLastValue.MIN_VALUE, 0);
  assert_equals(mojo.tstest.EnumWithLastValue.MAX_VALUE, 10);
}, 'Test an enum that ends with a value has correct generated values.');

test(() => {
  assert_equals(mojo.tstest.EnumWithInterspersedValues.ZERO, 0);
  assert_equals(mojo.tstest.EnumWithInterspersedValues.THREE, 3);
  assert_equals(mojo.tstest.EnumWithInterspersedValues.FOUR, 4);
  assert_equals(mojo.tstest.EnumWithInterspersedValues.EIGHT, 8);
  assert_equals(mojo.tstest.EnumWithInterspersedValues.NINE, 9);
  assert_equals(mojo.tstest.EnumWithInterspersedValues.MIN_VALUE, 0);
  assert_equals(mojo.tstest.EnumWithInterspersedValues.MAX_VALUE, 9);
}, 'Test an enum with interspersed values has correct generated values.');
</script>
